package org.jeecg.enums.base;

/**
 * 住户类型(1.业主,2.同住人,3.租客)
 */
public enum BaseCustomerCategoryEnum {
    BASE_CUSTOMER_CATEGORY_OWNER(1, "业主"),
    BASE_CUSTOMER_CATEGORY_PARTNER(2, "同住人"),
    BASE_CUSTOMER_CATEGORY_TENANT(3, "租户"),
    ;

    private Integer code;
    private String desc;

    BaseCustomerCategoryEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return "";
        BaseCustomerCategoryEnum[] enums = values();
        for (BaseCustomerCategoryEnum typeEnum : enums) {
            if (value.intValue()  == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        BaseCustomerCategoryEnum[] enums = values();
        for (BaseCustomerCategoryEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }

}
